import rxAjax from '@/assets/js/ajax.js';

//表单变更记录 api接口
export const FormChangeLogApi = {};

FormChangeLogApi.baseUrl= '/api-form/form/core/formChangeLog';
FormChangeLogApi.exportUrl= FormChangeLogApi.baseUrl + '/listExport';

//查询列表
FormChangeLogApi.query=function (parameter) {
  var url= FormChangeLogApi.baseUrl + '/query';
  return rxAjax.postJson(url,parameter).then (res => {
    return res.result
  })
}

/**
* 获取单记录
* @param pkId
* @returns {*}
*/
FormChangeLogApi.get =function(pkId) {
  var url= FormChangeLogApi.baseUrl + '/get?pkId=' + pkId;
  return rxAjax.get(url);
}

//保存数据
FormChangeLogApi.save =function(parameter) {
  var url= FormChangeLogApi.baseUrl + '/save';
  return rxAjax.postJson(url,parameter);
}

//删除数据
FormChangeLogApi.del =function(parameter) {
  var url= FormChangeLogApi.baseUrl + '/del';
  return rxAjax.postUrl(url,parameter);
}

//租户同步表单
FormChangeLogApi.getFormChangeLog =function(parameter) {
    var url= FormChangeLogApi.baseUrl + '/getFormChangeLog';
    return rxAjax.postForm(url,parameter);
}

//租户同步表单
FormChangeLogApi.syncForm =function(parameter) {
    var url= FormChangeLogApi.baseUrl + '/syncForm';
    return rxAjax.postJson(url,parameter);
}

//获取变更的所有的实体
FormChangeLogApi.selectGroupByBoAlias =function() {
    var url= FormChangeLogApi.baseUrl + '/selectGroupByBoAlias';
    return rxAjax.get(url);
}

//获取已执行的记录
FormChangeLogApi.getExecutedLog =function(dsAlias) {
    var url= FormChangeLogApi.baseUrl + '/getExecutedLog?dsAlias='+dsAlias;
    return rxAjax.get(url);
}

//忽略sql
FormChangeLogApi.setIgnore =function(parameter) {
    var url= FormChangeLogApi.baseUrl + '/setIgnore';
    return rxAjax.postForm(url,parameter);
}

//根据数据源别名获取获取忽略的记录
FormChangeLogApi.getIgnoreFormChangeLog =function(dsAlias) {
    var url= FormChangeLogApi.baseUrl + '/getIgnoreFormChangeLog?dsAlias='+dsAlias;
    return rxAjax.get(url);
}

export  default FormChangeLogApi;

